package com.shaco.heroproject.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by dllo on 15/11/11.
 */
public class MySQLliteOpenHelper extends SQLiteOpenHelper{
    public MySQLliteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = " create table " + Constant.TABLE_NAME_ALLHERORESULT
                + " ( " + Constant.COLUMN_HERO_ALL_ID + " varchar(255),"
                + Constant.COLUMN_HERO_ALL_NAME_C + " varchar(255),"
                + Constant.COLUMN_HERO_ALL_TAGS + " varchar(255),"
                + Constant.COLUMN_HERO_ALL_IMG + " varchar(255),"
                + Constant.COLUMN_HERO_ALL_TITLE + " varchar(255),"
                + "_msgId integer primary key autoincrement" + " ) ";
        db.execSQL(sql);

        String sql1 = " create table " + Constant.TABLE_NAME_LATESTNEWS
                +" ( "+Constant.COLUMN_LATESTNEWS_COMMENT_COUNT+" varchar(255),"
                +Constant.COLUMN_LATESTNEWS_ICON+" varchar(255),"
                +Constant.COLUMN_LATESTNEWS_ID+" varchar(255),"
                +Constant.COLUMN_LATESTNEWS_SOURCE+" varchar(255),"
                +Constant.COLUMN_LATESTNEWS_TITLE+" varchar(255),"
                +Constant.COLUMN_LATESTNEWS_TYPE+" varchar(255),"
                + "_msgId integer primary key autoincrement" + " ) ";
        db.execSQL(sql1);

        String sql2 = " create table " + Constant.TABLE_NAME_LATESTNEWSPAGE
                +" ( "+Constant.COLUMN_LATESTNEWSPAGE_ARTICLE_ID+" varchar(255),"
                +Constant.COLUMN_LATESTNEWSPAGE_BAN_IMG+" varchar(255),"
                +Constant.COLUMN_LATESTNEWSPAGE_NAME+" varchar(255),"
                +Constant.COLUMN_LATESTNEWSPAGE_TYPE+" varchar(255),"
                + "_msgId integer primary key autoincrement" + " ) ";
        db.execSQL(sql2);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
